*STATA DO FILE FOR THE ARTICLE "UNDERSTANDING DISCRIMINATION: OUTCOME-RELEVANT INFORMATION DOES NOT MITIGATE DISCRIMINATION" PUBLISHED IN SOCIAL PROBLEMS
*Author: Mogens Jin Pedersen (mp@ifs.ku.dk) and Vibeke L. Nielsen
*Date: October 8, 2021

*IMPORTANT - Insert path to the data file "Discrimination - Data File 20211008.dta" below (instead of "[xxxx]")

use "[xxxx]\Discrimination - Data File 20211008.dta", clear

*****************************************
*VARIABLE CONSTRUCTION
*****************************************
	{
	*Generate GP
	rename pipe_gender_q1 gp_g
	rename pipe_info_q1 gp_i
	recode gp_i (2=0)
	egen gp_y1 = std(q1_1)
	egen gp_y2 = std(q2_1)

	*Generate Babysitter
	rename pipe_gender_q3 baby_g
	rename pipe_info_q3 baby_i
	recode baby_i (2=0)
	egen baby_y1 = std(q3_1)
	egen baby_y2 = std(q4_1)

	*Generate Cleaning
	rename pipe_Q5_land clean_e
	recode clean_e (1=3) (3=1)
	label define clean 1 "Native-Native" 2 "Native-Foreing" 3 "Foreign-Native"
	label val clean_e clean
	rename pipe_info_q5 clean_i
	recode clean_i (2=0)
	egen clean_y1 = std(q5_1)
	egen clean_y2 = std(q5b_1)

	*Check
	su gp_* baby_* clean_*
	}

*****************************************
*DESCRIPTIVE STATISTICS 
*****************************************
	{
	*Generate variables
	tab gender, gen(fem) 
	tab ethnicity1
	recode ethnicity1 (977=99) (988=99) (.=99)
	tab ethnicity1, gen(eth)
	tab profile_age, gen(age) 
	tab profile_education*, gen(edu)
	tab region, gen(reg)

	tabstat q1_1 q2_1 q3_1 q4_1 q5_1 q5b_1, s(mean sd min max n) format(%9.3g) 
}

*Table 1. Descriptive statistics
	tabstat fem1-reg5, s(mean sd min max n) format(%9.2g) 

*****************************************
*BALANCE CHECK
*****************************************
*Chi-squared test
	{
	egen gp8= concat(gp_g gp_i)
	egen baby8= concat(baby_g baby_i)
	egen clean6 = concat(clean_e clean_i)
	}
	
	tab gp8 gender, chi2 nof
	tab gp8 ethnicity1, chi2 nof
	tab gp8 profile_age, chi2 nof
	tab gp8 profile_edu*, chi2 nof
	tab gp8 region, chi2 nof

	tab baby8 gender, chi2 nof
	tab baby8 ethnicity1, chi2 nof
	tab baby8 profile_age, chi2 nof
	tab baby8 profile_edu*, chi2 nof
	tab baby8 region, chi2 nof

	tab clean6 gender, chi2 nof
	tab clean6 ethnicity1, chi2 nof
	tab clean6 profile_age, chi2 nof
	tab clean6 profile_edu*, chi2 nof
	tab clean6 region, chi2 nof

*Mlogit (prop > chi2)
	{
	destring gp8, replace
	destring baby8, replace
	destring clean6, replace
	}
	quietly: mlogit gp8 i.gender i.ethnicity1 i.profile_age i.profile_edu* i.region
	di e(p)
	quietly: mlogit baby8 i.gender i.ethnicity1 i.profile_age i.profile_edu* i.region
	di e(p)
	quietly: mlogit clean6 i.gender i.ethnicity1 i.profile_age i.profile_edu* i.region
	di e(p)
	
*****************************************
*MANIPULATION CHECK
*****************************************
	{
	tab gp_g q6 
	gen gp_mc =0
	replace gp_mc =99 if q6 ==977
	replace gp_mc =1 if q6==1 & gp_g ==1
	replace gp_mc =1 if q6==2 & gp_g ==2
	replace gp_mc =1 if q6==3 & gp_g ==3
	replace gp_mc =1 if q6==3 & gp_g ==4

	tab baby_g q7
	gen baby_mc =0
	replace baby_mc =99 if q7 ==977
	replace baby_mc =1 if q7==1 & baby_g ==1
	replace baby_mc =1 if q7==2 & baby_g ==2
	replace baby_mc =1 if q7==3 & baby_g ==3
	replace baby_mc =1 if q7==3 & baby_g ==4

	tab clean_e q8
	gen clean_mc =0
	replace clean_mc =99 if q8 ==977
	replace clean_mc =1 if q8==1 & clean_e ==1
	replace clean_mc =1 if q8==2 & clean_e ==3
	replace clean_mc =1 if q8==3 & clean_e ==2
	}
	tab gp_mc
	tab baby_mc
	tab clean_mc

*****************************************
*RESULTS
*****************************************
{
*GP - Y1
eststo A0: quietly: reg gp_y1 i.gp_g, r 
eststo A0m: quietly: margins gp_g, post
eststo A1: quietly: reg gp_y1 i.gp_g##i.gp_i, r 
eststo A1m: quietly: margins gp_g, by(i.gp_i) post

quietly: reg gp_y1 i.gp_g if gp_i==0, r
eststo A_gp1: quietly: margins gp_g, post
quietly: reg gp_y1 i.gp_g if gp_i==1, r
eststo A_gp2: quietly: margins gp_g, post

quietly: reg gp_y1 i.gp_g##i.gp_i, r
eststo A_gpr: quietly: margins r.gp_i, by(gp_g) post
quietly: reg gp_y1 i.gp_g##i.gp_i, r
eststo A_gpr2: quietly: margins r.gp_i, by(r.gp_g) post

*GP - Y2
eststo B0: quietly: reg gp_y2 i.gp_g, r
eststo B0m: quietly: margins gp_g, post
eststo B1: quietly: reg gp_y2 i.gp_g##i.gp_i, r
eststo B1m: quietly: margins gp_g, by(i.gp_i) post

quietly: reg gp_y2 i.gp_g if gp_i==0, r
eststo B_gp1: quietly: margins gp_g, post
quietly: reg gp_y2 i.gp_g if gp_i==1, r
eststo B_gp2: quietly: margins gp_g, post

quietly: reg gp_y2 i.gp_g##i.gp_i, r
eststo B_gpr: quietly: margins r.gp_i, by(gp_g) post
quietly: reg gp_y2 i.gp_g##i.gp_i, r
eststo B_gpr2: quietly: margins r.gp_i, by(r.gp_g) post

*Babysitter - Y1
eststo C0: quietly: reg baby_y1 i.baby_g, r
eststo C0m: quietly: margins baby_g, post
eststo C1: quietly: reg baby_y1 i.baby_g##i.baby_i, r
eststo C1m: quietly: margins baby_g, by(i.baby_i) post

quietly: reg baby_y1 i.baby_g if baby_i==0, r
eststo C_baby1: quietly: margins baby_g, post
quietly: reg baby_y1 i.baby_g if baby_i==1, r
eststo C_baby2: quietly: margins baby_g, post

quietly: reg baby_y1 i.baby_g##i.baby_i, r
eststo C_babyr: quietly: margins r.baby_i, by(baby_g) post
quietly: reg baby_y1 i.baby_g##i.baby_i, r
eststo C_babyr2: quietly: margins r.baby_i, by(r.baby_g) post

*Babysitter - Y2
eststo D0: quietly: reg baby_y2 i.baby_g, r
eststo D0m: quietly: margins baby_g, post
eststo D1: quietly: reg baby_y2 i.baby_g##i.baby_i, r
eststo D1m: quietly: margins baby_g, by(i.baby_i) post

quietly: reg baby_y2 i.baby_g if baby_i==0, r
eststo D_baby1: quietly: margins baby_g, post
quietly: reg baby_y2 i.baby_g if baby_i==1, r
eststo D_baby2: quietly: margins baby_g, post

quietly: reg baby_y2 i.baby_g##i.baby_i, r
eststo D_babyr: quietly: margins r.baby_i, by(baby_g) post
quietly: reg baby_y2 i.baby_g##i.baby_i, r
eststo D_babyr2: quietly: margins r.baby_i, by(r.baby_g) post

*Cleaning - Y1
eststo E0: quietly: reg clean_y1 i.clean_e, r
eststo E0m: quietly: margins clean_e, post
eststo E1: quietly: reg clean_y1 i.clean_e##i.clean_i, r
eststo E1m: quietly: margins clean_e, by(i.clean_i) post

quietly: reg clean_y1 i.clean_e if clean_i==0, r
eststo E_clean1: quietly: margins clean_e, post
quietly: reg clean_y1 i.clean_e if clean_i==1, r
eststo E_clean2: quietly: margins clean_e, post

quietly: reg clean_y1 i.clean_e##i.clean_i, r
eststo E_cleanr: quietly: margins r.clean_i, by(clean_e) post
quietly: reg clean_y1 i.clean_e##i.clean_i, r
eststo E_cleanr2: quietly: margins r.clean_i, by(r.clean_e) post

*Cleaning - Y2
eststo F0: quietly: reg clean_y2 i.clean_e, r
eststo F0m: quietly: margins clean_e, post
eststo F1: quietly: reg clean_y2 i.clean_e##i.clean_i, r
eststo F1m: quietly: margins clean_e, by(i.clean_i) post

quietly: reg clean_y2 i.clean_e if clean_i==0, r
eststo F_clean1: quietly: margins clean_e, post
quietly: reg clean_y2 i.clean_e if clean_i==1, r
eststo F_clean2: quietly: margins clean_e, post

quietly: reg clean_y2 i.clean_e##i.clean_i, r
eststo F_cleanr: quietly: margins r.clean_i, by(clean_e) post
quietly: reg clean_y2 i.clean_e##i.clean_i, r
eststo F_cleanr2: quietly: margins r.clean_i, by(r.clean_e) post
}

*APPENDIX 

*Table A-1 (Appendix)
	esttab A0 B0 C0 D0 E0 F0, b(%9.3f) se(%9.3f) compress r2 ar2 drop(1.gp_g 1.baby_g 1.clean_e)

*Table A-2 (Appendix)
	esttab A0m B0m C0m D0m E0m F0m, b(%9.3f) se(%9.3f) compress 

*Table A-3 (Appendix)
	esttab A1 B1 C1 D1 E1 F1, b(%9.3f) se(%9.3f) compress r2 ar2 drop(1.gp_g 0.gp_i 1.gp_g* 2.gp_g#0* 3.gp_g#0* 4.gp_g#0* ///
	1.baby_g 0.baby_i 1.baby_g* 2.baby_g#0* 3.baby_g#0* 4.baby_g#0* 1.clean_e 0.clean_i 1.clean_e* 2.clean_e#0* 3.clean_e#0*)

*Table A-4 (Appendix)
	esttab A1m B1m C1m D1m E1m F1m, b(%9.3f) se(%9.3f) compress  

*Table A-5 (Appendix)
	esttab A_gpr2 B_gpr2 C_babyr2 D_babyr2 E_cleanr2 F_cleanr2, b(%9.3f) p(%9.2g) compress

*MAIN DOCUMENT

*Figure 2 - Marginal Effects of SGC
	
		*(a)
		coefplot A0m, msymbol(O) mfcolor(dimgray) mlcolor(black) ///
		title({it:(a)}, placement(e)) subtitle(" ""{bf:Preference for A             Preference for B}"" ") ///
		coeflabels(1.gp_g = "Male" 2.gp_g = "Female" 3.gp_g = "Male" 4.gp_g = "Female", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.gp_g = "Male" 2.gp_g = "Female" 3.gp_g = "Female" 4.gp_g = "Male", notick angle(horizontal)) ///
		ytitle("{bf:Gender of A}"" ") ytitle(" ""{bf:Gender of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  

		*(b)
		coefplot B0m, msymbol(D) mfcolor(dimgray) mlcolor(black) ///
		title({it:(b)}, placement(e)) subtitle(" ""{bf:Trust for A                       Trust for B}"" ") ///
		coeflabels(1.gp_g = "Male" 2.gp_g = "Female" 3.gp_g = "Male" 4.gp_g = "Female", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.gp_g = "Male" 2.gp_g = "Female" 3.gp_g = "Female" 4.gp_g = "Male", notick angle(horizontal)) ///
		ytitle("{bf:Gender of A}"" ") ytitle(" ""{bf:Gender of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  

		*(c)
		coefplot C0m, msymbol(O) mfcolor(dimgray) mlcolor(black) ///
		title({it:(c)}, placement(e)) subtitle(" ""{bf:Preference for A             Preference for B}"" ") ///
		coeflabels(1.baby_g = "Male" 2.baby_g = "Female" 3.baby_g = "Male" 4.baby_g = "Female", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.baby_g = "Male" 2.baby_g = "Female" 3.baby_g = "Female" 4.baby_g = "Male", notick angle(horizontal)) ///
		ytitle("{bf:Gender of A}"" ") ytitle(" ""{bf:Gender of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  

		*(d)
		coefplot D0m, msymbol(D) mfcolor(dimgray) mlcolor(black) ///
		title({it:(d)}, placement(e)) subtitle(" ""{bf:Trust for A                       Trust for B}"" ") ///
		coeflabels(1.baby_g = "Male" 2.baby_g = "Female" 3.baby_g = "Male" 4.baby_g = "Female", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.baby_g = "Male" 2.baby_g = "Female" 3.baby_g = "Female" 4.baby_g = "Male", notick angle(horizontal)) ///
		ytitle("{bf:Gender of A}"" ") ytitle(" ""{bf:Gender of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  

		*(e)
		coefplot E0m, msymbol(O) mfcolor(dimgray) mlcolor(black) ///
		title({it:(e)}, placement(e)) subtitle(" ""{bf:Preference for A             Preference for B}"" ") ///
		coeflabels(1.clean_e = "Native" 2.clean_e = "Native" 3.clean_e = "Foreign", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.clean_e = "Native" 2.clean_e = "Foreign" 3.clean_e = "Native", notick angle(horizontal)) ///
		ytitle("{bf:Origin of A}"" ") ytitle(" ""{bf:Origin of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  
		
		*(f)
		coefplot F0m, msymbol(D) mfcolor(dimgray) mlcolor(black) ///
		title({it:(f)}, placement(e)) subtitle(" ""{bf:Trust for A                       Trust for B}"" ") ///
		coeflabels(1.clean_e = "Native" 2.clean_e = "Native" 3.clean_e = "Foreign", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.clean_e = "Native" 2.clean_e = "Foreign" 3.clean_e = "Native", notick angle(horizontal)) ///
		ytitle("{bf:Origin of A}"" ") ytitle(" ""{bf:Origin of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  

*Figure 3 - Marginal Effects of SGC by RQ
	
		*(a)
		coefplot (A_gp1, label(No Ratings) msymbol(O) mfcolor(dimgray) mlcolor(black) offset(.225)) ///
		(A_gp2, label(Ratings) msymbol(O) mfcolor(gs10) mlcolor(black) offset(-.225)), ///
		title({it:(a)}, placement(e)) subtitle(" ""{bf:Preference for A             Preference for B}"" ") ///
		coeflabels(1.gp_g = "Male" 2.gp_g = "Female" 3.gp_g = "Male" 4.gp_g = "Female", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		mfcolor(white) msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.gp_g = "Male" 2.gp_g = "Female" 3.gp_g = "Female" 4.gp_g = "Male", notick angle(horizontal)) ///
		ytitle("{bf:Gender of A}"" ") ytitle(" ""{bf:Gender of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  

		*(b)
		coefplot (B_gp1, label(No Ratings) msymbol(D) mfcolor(dimgray) mlcolor(black) offset(.225)) ///
		(B_gp2, label(Ratings) msymbol(D) mfcolor(gs10)  mlcolor(black) offset(-.225)), ///
		title({it:(b)}, placement(e)) subtitle(" ""{bf:Trust for A                       Trust for B}"" ") ///
		coeflabels(1.gp_g = "Male" 2.gp_g = "Female" 3.gp_g = "Male" 4.gp_g = "Female", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		mfcolor(white) msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.gp_g = "Male" 2.gp_g = "Female" 3.gp_g = "Female" 4.gp_g = "Male", notick angle(horizontal)) ///
		ytitle("{bf:Gender of A}"" ") ytitle(" ""{bf:Gender of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  

		*(c)
		coefplot (C_baby1, label(No Ratings) msymbol(O) mfcolor(dimgray) mlcolor(black) offset(.225)) ///
		(C_baby2, label(Ratings) msymbol(O) mfcolor(gs10)  mlcolor(black) offset(-.225)), ///
		title({it:(c)}, placement(e)) subtitle(" ""{bf:Preference for A             Preference for B}"" ") ///
		coeflabels(1.baby_g = "Male" 2.baby_g = "Female" 3.baby_g = "Male" 4.baby_g = "Female", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		mfcolor(white) msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.baby_g = "Male" 2.baby_g = "Female" 3.baby_g = "Female" 4.baby_g = "Male", notick angle(horizontal)) ///
		ytitle("{bf:Gender of A}"" ") ytitle(" ""{bf:Gender of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  
		graph export "S:\SAMF-IFS-Mogens_Jin_Pedersen\VIVE 'Sikker Drev' (J - FSE_Visitation Rights) 30.08.2019\New YouGov 200519\Output2\C_BS.tif", as(tif) replace

		*(d)
		coefplot (D_baby1, label(No Ratings) msymbol(D) mfcolor(dimgray) mlcolor(black) offset(.225)) ///
		(D_baby2, label(Ratings) msymbol(D) mfcolor(gs10) mlcolor(black) offset(-.225)), ///
		title({it:(d)}, placement(e)) subtitle(" ""{bf:Trust for A                       Trust for B}"" ") ///
		coeflabels(1.baby_g = "Male" 2.baby_g = "Female" 3.baby_g = "Male" 4.baby_g = "Female", notick)  ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		mfcolor(white) msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.baby_g = "Male" 2.baby_g = "Female" 3.baby_g = "Female" 4.baby_g = "Male", notick angle(horizontal)) ///
		ytitle("{bf:Gender of A}"" ") ytitle(" ""{bf:Gender of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  
		
		*(e)
		coefplot (E_clean1, label(No Ratings) msymbol(O) mfcolor(dimgray) mlcolor(black) offset(.225)) ///
		(E_clean2, label(Ratings) msymbol(O) mfcolor(gs10)  mlcolor(black) offset(-.225)), ///
		title({it:(e)}, placement(e)) subtitle(" ""{bf:Preference for A             Preference for B}"" ") ///
		coeflabels(1.clean_e = "Native" 2.clean_e = "Native" 3.clean_e = "Foreign", notick) ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		mfcolor(white) msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.clean_e = "Native" 2.clean_e = "Foreign" 3.clean_e = "Native", notick angle(horizontal)) ///
		ytitle("{bf:Origin of A}"" ") ytitle(" ""{bf:Origin of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  
		
		*(f)
		coefplot (F_clean1, label(No Ratings) msymbol(D) mfcolor(dimgray) mlcolor(black) offset(.225)) ///
		(F_clean2, label(Ratings) msymbol(D) mfcolor(gs10) mlcolor(black) offset(-.225)), ///
		title({it:(f)}, placement(e)) subtitle(" ""{bf:Trust for A                       Trust for B}"" ") ///
		coeflabels(1.clean_e = "Native" 2.clean_e = "Native" 3.clean_e = "Foreign", notick) ///
		xline(0, lpattern(dash) lcolor(gray)) xscale(range(-.5(1).5)) xlabel(-.4(.1).4, nogrid format(%9.2g)) ///
		mfcolor(white) msize(large)  grid(glcolor(white)) graphregion(fcolor(white)) ciopts(lcol(black)) ///
		yscale(alt line axis(2)) groups(1.clean_e = "Native" 2.clean_e = "Foreign" 3.clean_e = "Native", notick angle(horizontal)) ///
		ytitle("{bf:Origin of A}"" ") ytitle(" ""{bf:Origin of B}", axis(2)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)  
	
*Figure 4 - Contrasts
		
		coefplot A_gpr, bylabel("{bf:Preference {it:(a)}}") msymbol(T) mfcolor(dimgray) mlcolor(black) || ///
		B_gpr, bylabel("{bf:Trust {it:(b)}}") mlcolor(black) || , xline(0, lpattern(dash) lcolor(gray)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)   ///
		coeflabels(r1vs0.gp_i@1.gp_g = "Male-Male" r1vs0.gp_i@2.gp_g = "Female-Female" r1vs0.gp_i@3.gp_g = "Male-Female" r1vs0.gp_i@4.gp_g = "Female-Male" , notick) ///
		mfcolor(white) msize(large)  grid(glcolor(white)) ciopts(lcol(black)) ///
		subtitle(, bcolor(white) ) ///
		ytitle("{bf:Gender of A-B}") ///
		byopts(title("General Practioner: Ratings (vs. No Ratings)"" ") graphregion(fcolor(white))) xscale(range(-.3(1).3)) xlabel(-.3(.1).3, nogrid format(%9.2g))

		coefplot C_babyr, bylabel("{bf:Preference {it:(c)}}") msymbol(T) mfcolor(dimgray) mlcolor(black) || ///
		D_babyr, bylabel("{bf:Trust {it:(d)}}") mlcolor(black) ||, xline(0, lpattern(dash) lcolor(gray)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)   ///
		coeflabels(r1vs0.baby_i@1.baby_g = "Male-Male" r1vs0.baby_i@2.baby_g = "Female-Female" r1vs0.baby_i@3.baby_g = "Male-Female" r1vs0.baby_i@4.baby_g = "Female-Male" , notick) ///
		mfcolor(white) msize(large)  grid(glcolor(white)) ciopts(lcol(black)) ///
		subtitle(, bcolor(white) ) ///
		ytitle("{bf:Gender of A-B}") ///
		byopts(title("Babysitter: Ratings (vs. No Ratings)"" ") graphregion(fcolor(white))) xscale(range(-.3(1).3)) xlabel(-.3(.1).3, nogrid format(%9.2g))

		coefplot E_cleanr, bylabel("{bf:Preference {it:(e)}}") msymbol(T) mfcolor(dimgray)  mlcolor(black) || ///
		F_cleanr, bylabel("{bf:Trust {it:(f)}}") mlcolor(black) ||, xline(0, lpattern(dash) lcolor(gray)) ///
		mlabel(@b) format(%9.3f) mlabposition(2) mlabsize(small) mlabcolor(black)   ///
		coeflabels(r1vs0.clean_i@1.clean_e = "Native-Native" r1vs0.clean_i@2.clean_e = "Native-Foreign" r1vs0.clean_i@3.clean_e = "Foreign-Native", notick) //////
		mfcolor(white) msize(large)  grid(glcolor(white)) ciopts(lcol(black)) ///
		subtitle(, bcolor(white) ) ///
		ytitle("{bf:Origin of A-B}") ///
		byopts(title("Cleaning: Ratings (vs. No Ratings)"" ") graphregion(fcolor(white))) xscale(range(-.3(1).3)) xlabel(-.3(.1).3, nogrid format(%9.2g))

*Heterogeneous effects
	{
	tab gender
	tab ethnicity1 // Too few obs. (91% Danes)
	tab profile_edu* // edu1 = "Grundskole/gymanasium" (Low)

	*Gender, GP
	reg gp_y1 i.gp_g##i.gp_i##i.gender, r 
	margins r.gp_i, at(gp_g = (1 2 3 4)) over(r.gender) post // no interaction
	eststo A_gen
	reg gp_y2 i.gp_g##i.gp_i##i.gender, r 
	margins r.gp_i, at(gp_g = (1 2 3 4)) over(r.gender) post // no interaction
	eststo B_gen

	*Gender, Babysitter
	reg baby_y1 i.baby_g##i.baby_i##i.gender, r 
	margins r.baby_i, at(baby_g = (1 2 3 4)) over(r.gender) post // no interaction
	eststo C_gen
	reg baby_y2 i.baby_g##i.baby_i##i.gender, r 
	margins r.baby_i, at(baby_g = (1 2 3 4)) over(r.gender) post // interaction: Female-Female
	eststo D_gen

	*Gender, Cleaning
	reg clean_y1 i.clean_e##i.clean_i##i.gender, r 
	margins r.clean_i, at(clean_e = (1 2 3)) over(r.gender) post // no interaction
	eststo E_gen
	reg clean_y2 i.clean_e##i.clean_i##i.gender, r 
	margins r.clean_i, at(clean_e = (1 2 3)) over(r.gender) post // no interaction
	eststo F_gen

	*Education, GP
	reg gp_y1 i.gp_g##i.gp_i##i.edu1, r 
	margins r.gp_i, at(gp_g = (1 2 3 4)) over(r.edu1) post // no interaction
	eststo A_edu
	reg gp_y2 i.gp_g##i.gp_i##i.edu1, r 
	margins r.gp_i, at(gp_g = (1 2 3 4)) over(r.edu1) post // no interaction
	eststo B_edu

	*Education, Babysitter
	reg baby_y1 i.baby_g##i.baby_i##i.edu1, r 
	margins r.baby_i, at(baby_g = (1 2 3 4)) over(r.edu1) post // no interaction
	eststo C_edu
	reg baby_y2 i.baby_g##i.baby_i##i.edu1, r 
	margins r.baby_i, at(baby_g = (1 2 3 4)) over(r.edu1) post // no interaction
	eststo D_edu

	*Education, Cleaning
	reg clean_y1 i.clean_e##i.clean_i##i.edu1, r 
	margins r.clean_i, at(clean_e = (1 2 3)) over(r.edu1) post // no interaction
	eststo E_edu
	reg clean_y2 i.clean_e##i.clean_i##i.edu1, r 
	margins r.clean_i, at(clean_e = (1 2 3)) over(r.edu1) post // no interaction
	eststo F_edu
	}

*Table A-6 (Appendix)
	esttab A_gen B_gen C_gen D_gen E_gen F_gen, b(%9.3f) p(%9.2g) compress
	
*Table A-7 (Appendix)
	esttab A_edu B_edu C_edu D_edu E_edu F_edu, b(%9.3f) p(%9.2g) compress
